export default {
	data() {
		return {

		};
	},
	methods: {
		cellStyle({ column, row }) {
			const styleConf = {};
			if (['processName'].includes(column.field)) {
				if (row.processCode === 'SM') {
					styleConf.backgroundColor = '#fef0f0';
				} else if (row.processCode === 'BT') {
					styleConf.backgroundColor = '#fdf6ec';
				} else if (row.processCode === 'CS') {
					styleConf.backgroundColor = '#ecf5ff';
				} else if (row.processCode === 'XS') {
					styleConf.backgroundColor = '#fef0f0';
				} else if (['LT'].includes(row.processCode)) {
					styleConf.backgroundColor = '#fdf6ec';
				} else if (row.processCode === 'BX') {
					styleConf.backgroundColor = '#ecf5ff';
				} else if (row.processCode === 'BN') {
					styleConf.backgroundColor = '#f6ffed';
				}
				if (column.field === 'processName') {
					styleConf.fontSize = '14px';
					styleConf.fontWeight = '700';
				}
				return styleConf;
			}
		},
		mergeColMethod({ row, _rowIndex, column, visibleData }) {
			const prevRow = visibleData[_rowIndex - 1];
			let nextRow = visibleData[_rowIndex + 1];
			if (column.property === 'processName') {
				if (prevRow && prevRow.processName === row.processName) {
					return { rowspan: 0, colspan: 0 };
				} else {
					let countRowspan = 1;
					while (nextRow && nextRow.processName === row.processName) {
						nextRow = visibleData[++countRowspan + _rowIndex];
					}
					if (countRowspan > 1) {
						return { rowspan: countRowspan, colspan: 1 };
					}
				}
			} else if (column.property === 'processOutput') {
				if (prevRow && prevRow.processName === row.processName && prevRow.processOutput === row.processOutput) {
					return { rowspan: 0, colspan: 0 };
				} else {
					let countRowspan = 1;
					while (nextRow && nextRow.processName === row.processName && nextRow.processOutput === row.processOutput) {
						nextRow = visibleData[++countRowspan + _rowIndex];
					}
					if (countRowspan > 1) {
						return { rowspan: countRowspan, colspan: 1 };
					}
				}
			} else if (column.property === 'processQty') {
				if (prevRow && prevRow.processName === row.processName && prevRow.processQty === row.processQty) {
					return { rowspan: 0, colspan: 0 };
				} else {
					let countRowspan = 1;
					while (nextRow && nextRow.processName === row.processName && nextRow.processQty === row.processQty) {
						nextRow = visibleData[++countRowspan + _rowIndex];
					}
					if (countRowspan > 1) {
						return { rowspan: countRowspan, colspan: 1 };
					}
				}
			}
		}

	}
};
